package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.CountService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;

/**
 * Created by anqian on 2017/4/7.
 */
@Controller
@RequestMapping("/rds_count")
public class CountController {
    @Resource
    private CountService countService;

    @RequestMapping(value = "/getRoadSign4DT")
    @ResponseBody
    public DTResponseDto getRoadSign4DT(Integer userId, Integer orgId, DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = countService.getRoadSign4DT(userId, orgId, dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/getRoadPole4DT")
    @ResponseBody
    public DTResponseDto getRoadPole4DT(Integer userId, Integer orgId, DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = countService.getRoadPole4DT(userId, orgId, dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/getRoadSignCount")
    @ResponseBody
    public JsonMsgDto getRoadSignCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getRoadSignCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadPoleCount")
    @ResponseBody
    public JsonMsgDto getRoadPoleCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getRoadPoleCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getCoverCount")
    @ResponseBody
    public JsonMsgDto getCoverCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getCoverCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getHighLeverCount")
    @ResponseBody
    public JsonMsgDto getHighLeverCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getHighLeverCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getGuardrailCount")
    @ResponseBody
    public JsonMsgDto getGuardrailCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getGuardrailCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getMonitorCount")
    @ResponseBody
    public JsonMsgDto getMonitorCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getMonitorCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadLineCount")
    @ResponseBody
    public JsonMsgDto getRoadLineCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getRoadLineCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSignalLampCount")
    @ResponseBody
    public JsonMsgDto getSignalLampCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getSignalLampCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSignalMachineCount")
    @ResponseBody
    public JsonMsgDto getSignalMachineCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getSignalMachineCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSolarEnergyCount")
    @ResponseBody
    public JsonMsgDto getSolarEnergyCount(Integer orgId, Integer actorId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getSolarEnergyCount(orgId, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getAllRoadName")
    @ResponseBody
    public JsonMsgDto getAllRoadName(String provinceName, String cityName, String areaName, Integer userId, Integer orgId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getAllRoadName(provinceName, cityName, areaName, userId, orgId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getAllAreaName")
    @ResponseBody
    public JsonMsgDto getAllAreaName(Integer userId, Integer orgId, String provinceName, String cityName) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getAllAreaName(userId, orgId, provinceName, cityName));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getAllOrg")
    @ResponseBody
    public JsonMsgDto getAllOrgName(Integer userId, Integer orgId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getAllOrg(userId, orgId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getFault4DT")
    @ResponseBody
    public DTResponseDto getFault4DT(Integer userId, Integer orgId, DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = countService.getFault4DT(userId, orgId, dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/getMaintenance4DT")
    @ResponseBody
    public DTResponseDto getMaintenance4DT(Integer userId, Integer orgId, DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = countService.getMaintenance4DT(userId, orgId, dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/getDealOrg")
    @ResponseBody
    public JsonMsgDto getDealOrg(Integer userId, Integer orgId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getDealOrg(userId, orgId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }


    @RequestMapping(value = "/getDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getUnAuditSingCount")
    @ResponseBody
    public JsonMsgDto getUnAuditSingCount(Integer orgId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getUnAuditSingCount(orgId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getConservationOrg")
    @ResponseBody
    public JsonMsgDto getConservationOrg(Integer mainOrgId, Integer userId, Integer orgId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getConservationOrg(mainOrgId, userId, orgId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getProvinceName")
    @ResponseBody
    public JsonMsgDto getProvinceName(Integer userId, Integer orgId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getProvinceName(userId, orgId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getCityName")
    @ResponseBody
    public JsonMsgDto getCityName(Integer userId, Integer orgId, String provinceName) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getCityName(userId, orgId, provinceName));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getStartRoadName")
    @ResponseBody
    public JsonMsgDto getStartRoadName(Integer userId, Integer orgId, String provinceName, String cityName,
                                       String areaName, String endRoadName, String roadName) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getStartRoadName(userId, orgId, provinceName, cityName, areaName,
                    endRoadName, roadName));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getEndRoadName")
    @ResponseBody
    public JsonMsgDto getEndRoadName(Integer userId, Integer orgId, String startRoad, String provinceName, String cityName,
                                     String areaName, String roadName) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getEndRoadName(userId, orgId, startRoad, provinceName, cityName, areaName, roadName));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getPerSignCounts")
    @ResponseBody
    public JsonMsgDto getPerSignCounts(Integer userId, Integer orgId, String time, String province, String city, String area, String road) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getPerSignCounts(userId, orgId, time, province, city, area, road));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadSignPole4DT")
    @ResponseBody
    public DTResponseDto getRoadSignPole4DT(Integer userId, Integer orgId, DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = countService.getRoadSignPole4DT(userId, orgId, dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/getAreaRoadSignCount")
    @ResponseBody
    public JsonMsgDto getAreaRoadSignCount(Integer userId, Integer orgId, String roadSignCity) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getAreaRoadSignCount(userId, orgId, roadSignCity));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }


    @RequestMapping(value = "/getPerSignCountsByRoad")
    @ResponseBody
    public JsonMsgDto getPerSignCountsByRoad(String province, String city, String area, String orgName, String roadName) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getPerSignCountsByRoad(province, city, area, orgName, roadName));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/downRoadSignByExcel")
    @ResponseBody
    public void downRoadSignByExcel(HttpServletRequest request, HttpServletResponse response, String provinceName, String cityName, String areaName, String roadName, Integer orgChoose, Integer userId, Integer orgId) {
        try {
            String search = provinceName + "#" + cityName + "#" + areaName + "#" + roadName + "#" + orgChoose;
            OutputStream ouputStream = response.getOutputStream();
            HSSFWorkbook result = countService.downSignPoleByExcel(search, userId, orgId);
            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
            String userAgent = request.getHeader("User-Agent");
            userAgent = userAgent.toLowerCase();
            //判断浏览器版本
            String exportName = "标牌统计报表";
            if (userAgent.indexOf("msie") != -1) {
                response.setHeader("Content-disposition", "attachment;filename=" + new String(exportName.getBytes("gb2312"), "ISO8859-1") + ".xls");
            } else {
                response.setHeader("Content-disposition", "attachment;filename=" + new String(exportName.getBytes("UTF-8"), "ISO8859-1") + ".xls");
            }
            result.write(ouputStream);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @RequestMapping("/getSignFaultCount")
    @ResponseBody
    public JsonMsgDto getSignFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getSignFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getCoverAuditCount")
    @ResponseBody
    public JsonMsgDto getCoverAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getCoverAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getCoverFaultCount")
    @ResponseBody
    public JsonMsgDto getCoverFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getCoverFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getHighLeverAuditCount")
    @ResponseBody
    public JsonMsgDto getHighLeverAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getHighLeverAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getHighLeverFaultCount")
    @ResponseBody
    public JsonMsgDto getHighLeverFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getHighLeverFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getGuardrailAuditCount")
    @ResponseBody
    public JsonMsgDto getGuardrailAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getGuardrailAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getGuardrailFaultCount")
    @ResponseBody
    public JsonMsgDto getGuardrailFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getGuardrailFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getMonitorAuditCount")
    @ResponseBody
    public JsonMsgDto getMonitorAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getMonitorAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getMonitorFaultCount")
    @ResponseBody
    public JsonMsgDto getMonitorFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getMonitorFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getRoadLineAuditCount")
    @ResponseBody
    public JsonMsgDto getRoadLineAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getRoadLineAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getRoadLineFaultCount")
    @ResponseBody
    public JsonMsgDto getRoadLineFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getRoadLineFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSignalLampAuditCount")
    @ResponseBody
    public JsonMsgDto getSignalLampAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getSignalLampAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSignalLampFaultCount")
    @ResponseBody
    public JsonMsgDto getSignalLampFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getSignalLampFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSignalMachineAuditCount")
    @ResponseBody
    public JsonMsgDto getSignalMachineAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getSignalMachineAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSignalMachineFaultCount")
    @ResponseBody
    public JsonMsgDto getSignalMachineFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getSignalMachineFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSolarEnergyAuditCount")
    @ResponseBody
    public JsonMsgDto getSolarEnergyAuditCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getSolarEnergyAuditCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSolarEnergyFaultCount")
    @ResponseBody
    public JsonMsgDto getSolarEnergyFaultCount(Integer orgId, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(countService.getSolarEnergyFaultCount(orgId, actorId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getCoverDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getCoverDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getCoverDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getHighLeverDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getHighLeverDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getHighLeverDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getGuardrailDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getGuardrailDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getGuardrailDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getMonitorDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getMonitorDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getMonitorDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadLineDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getRoadLineDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getRoadLineDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSignLampDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getSignLampDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getSignLampDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSignalMachineDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getSignalMachineDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getSignalMachineDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSolarEnergyDealTalkTimes")
    @ResponseBody
    public JsonMsgDto getSolarEnergyDealTalkTimes(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getSolarEnergyDealTalkTimes(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getPositionList")
    @ResponseBody
    public JsonMsgDto getPositionList(Integer orgId, Integer orgType, Integer EquipmentType, String actorIds) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(countService.getAllInfo4Type(orgId, orgType, EquipmentType, actorIds));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getCount4Type")
    @ResponseBody
    public DTResponseDto getCount4Type(DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = countService.getCount4Type(dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return dtResponseDto;
    }

    @RequestMapping(value = "/getFault4Type")
    @ResponseBody
    public DTResponseDto getFault4Type(DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = countService.getFault4Type(dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return dtResponseDto;
    }

}
